package r21310.chap06.d1117;

import java.util.ArrayList;
import java.util.List;

public class English {
    public static void main(String[] args) {
        double cheng=0;
        List<Person> list=new ArrayList<>();
        list.add(new Person("刘备",90));
        list.add(new Person("哈哈",88));
        list.add(new Person("呵呵",85));
        list.add(new Person("张三",77));
        list.add(new Person("李四",88));
        list.add(new Person("王五",75));
        list.add(new Person("张飞",70));
        list.add(new Person("关羽",91));
        list.add(new Person("孙权",74));
        list.add(new Person("曹操",69));
        list.add(new Person("诸葛量",99));
        for (int i = 0; i < list.size(); i++) {
            Person c=list.get(i);
            cheng=c.getChengji()+cheng;
        }
        System.out.println(cheng/list.size());


    }
}
class Person{
    private String name;
    private int chengji;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getChengji() {
        return chengji;
    }

    public void setChengji(int chengji) {
        this.chengji = chengji;
    }

    public Person(String name, int chengji) {
        this.name = name;
        this.chengji = chengji;
    }

    @Override
    public String toString() {
        return this.name+this.chengji;
    }
}